package com.jcl.recruit.register.service;

import com.jcl.core.utils.StringUtils;
import com.jcl.recruit.corp.model.Subcompany;
import com.jcl.recruit.org.model.Department;
import com.jcl.recruit.user.model.User;

/**
 * @ClassName RegisterResult
 * @Description TODO
 * @Author yyliu
 * @Date 2018/9/14 11:35
 * @Version 1.0
 **/
public class RegisterResult {

    public static final String CORP_EXIST_CODE = "EXIST-20001";

    private String errorMsg;

    private String code;

    private Subcompany subcompany;

    private Department department;

    private User user;


    public boolean hasError(){
        if(StringUtils.hasLength(this.code)){
           return null != RegisterEnum.getName(this.code) ? true : false;
        }
        return false;
    }

    public String getErrorMsg() {
        if(StringUtils.hasLength(this.code)){
            errorMsg = RegisterEnum.getName(this.code);
        }
        return errorMsg;
    }

    public void setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public Subcompany getSubcompany() {
        return subcompany;
    }

    public void setSubcompany(Subcompany subcompany) {
        this.subcompany = subcompany;
    }

    public Department getDepartment() {
        return department;
    }

    public void setDepartment(Department department) {
        this.department = department;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }
}
